const mongoose = require('mongoose');

const userSettingsSchema = new mongoose.Schema({
  userId: {
    type: mongoose.Schema.Types.ObjectId,
    ref: 'User',
    required: true,
    unique: true
  },
  theme: {
    mode: {
      type: String,
      enum: ['light', 'dark', 'system'],
      default: 'light'
    },
    primaryColor: {
      type: String,
      default: '#1a5cff'
    },
    compact: {
      type: Boolean,
      default: false
    },
    animations: {
      type: Boolean,
      default: true
    }
  },
  notifications: {
    deployStart: {
      type: Boolean,
      default: true
    },
    deployComplete: {
      type: Boolean,
      default: true
    },
    deployFailed: {
      type: Boolean,
      default: true
    },
    browserNotification: {
      type: Boolean,
      default: false
    },
    emailNotification: {
      type: Boolean,
      default: false
    }
  },
  timezone: {
    type: String,
    default: 'Asia/Shanghai'
  }
});

module.exports = mongoose.model('UserSettings', userSettingsSchema); 